﻿@{
    ViewBag.Title = "DocumentView";
}
<script src="/Scripts/Documents.js"></script>

@using System.Diagnostics.Eventing.Reader
@using wne.models
@model wne.models.DocModel  
                          @* Изменил модель, исправить все вызовы из модели! *@

@using (Html.BeginForm("DocumentView", "Document", FormMethod.Post, new {id = "DocumentViewForm", onsubmit = "DocumentViewSubmit();"}))
{
    <div class="hero-unit row" style="padding: 10px 0px 10px 10px; margin: 10px 0px 10px 0px">
        <div class="row-fluid">
            <h2>Просмотр документа</h2>
        </div>
        <div class="row-fluid">
            <div class="span6">
                <div class="row-fluid">
                    <small>Номер документа</small>
                    <!--<input class="input-xlarge focused" id="Text1" type="text" value="123456-4321" disabled>-->
                    @Html.TextBoxFor(m => m.doc.Doc_ID, new { disabled = "disabled", @class = "input-xlarge focused" })
                    <input type="hidden" name="Doc_ID" id="Doc_ID" value="@Model.doc.Doc_ID">
                </div>
                <div class="row-fluid">
                    <div class="row-fluid"><small>Название документа </small></div>
                    <!--<input class="input-xlarge focused span12" id="Text2" type="text" value="документ о розовых котятках" disabled>-->
                    @Html.TextBoxFor(m => m.doc.Doc_Name, new { disabled = "disabled", @class = "input-xlarge focused span12" })
                </div>
            </div>
            <div class="span5 offset1">
                <div class="row-fluid">
                    <small>Имя автора </small>
                    <input class="input-xlarge focused" id="Text3" type="text" value="@ViewBag.Owner_Name" disabled>
                </div>
            </div>
        </div>
    </div>
    
    <div class="row-fluid">
        <div class="span6">
            
    <div class="row-fluid">
        @if (Model.fields != null)
        {
            int i = 0;
            foreach (DocField g in Model.fields)
            {
                if (g.type.Visible_Flag == "1")
                {
                    <div class="control-group">
                        <label class = "control-label" for="fields">@g.Field.Title</label>
                        @*@Html.LabelFor(m => m.fields[i].Field.Value, g.Field.Title, new {@class = "control-label"})*@
                        <div class ="controls">
                            @if (g.type.Editable_Falg == "1" && (g.type.Field_Type == 7 || g.type.Field_Type == 10))
                            {
                                <div class ="controls">
                                    <input type="file" name="fileUpload" id="upload_hidden" style="display: none;" onchange=" document.getElementById('upload_visible').value = this.value; " />
                                    <input type="text" readonly="1" id="upload_visible" onclick=" document.getElementById('upload_hidden').click(); " style="margin-bottom: 0;">
                                    <button class="btn" onclick=" document.getElementById('upload_hidden').click(); "><i class="icon-search"></i></button>    
                                </div>
                            }
                            else if (g.type.Editable_Falg == "1")
                            {
                                <input type="text" class = "input-xlarge" name="fields" value="@Model.fields[i].Field.Value"/>
                                @*@Html.TextBoxFor(m => m.fields[i].Field.Value)*@
                            }
                            else
                            {
                                <input type="text" disabled = "disabled" class = "input-xlarge" name="fields" value="@Model.fields[i].Field.Value"/>
                                @*@Html.TextBoxFor(m => m.fields[i].Field.Value, new {disabled = "disabled"})*@
                            }
                        </div> 
                    </div>

                }
                i++;
            }
        }
    </div>

            @*<p><strong>Файлы</strong></p>*@
           @* <div class="brd" style="width: 300px; height: 100px; overflow-y: scroll;">
                <div class="row-fluid">*@
                    @* цикл по файлам
                        @foreach ()
                        {
                            <div class="span10">документАААААААААААААА</div>
                            <div class="span1"><input type="checkbox" value=""><div>
                        }
                        *@
                    @*<div class="span10">документАААААААААААААА</div>
                    <div class="span1"><input type="checkbox" value=""></div>
                </div>
            </div>
        </div>


        <div class="span4">
            <strong>Приложен</strong>*@
            @*
            @Html.RadioButtonFor(m => m., original) @Html.LabelFor(m => m., "Оригинал")
            @Html.RadioButtonFor(m => m., copy) @Html.LabelFor(m => m., "Копия")
            *@
            
           
             

           @* <strong>Количество листов</strong>
            <input class="input focused" style="width: 20px" id="Text4" type="text" value="24" disabled>

            <br>
            <strong>№ экземпляра </strong>
            <input class="input focused" style="width: 20px" id="Text5" type="text" value="3" disabled>

            <p><strong>Срочность</strong></p>
            <select>
                <option>Обычная</option>
                <option>2</option>
                <option>3</option>
                <option>4</option>
                <option>5</option>
                <option>6</option>
            </select>*@
        </div>
    </div>
    
    <label class="radio">
                <input type="radio" name="optionsRadios" id="optionsRadios1" value="option1" >
                Отклонить
            </label>
    <label class="radio">
        <input type="radio" name="optionsRadios" id="optionsRadios2" value="option2">
        Принять
    </label>
    <label class="radio">
                <input type="radio" name="optionsRadios" id="optionsRadios3" value="option3" checked>
                Сохранить
            </label>
    
    <br />
    <button class="btn btn-primary" type="submit">Готово</button>
    <button type="button" class="btn" onclick="location.href = '/Document/EditDoc'">Отменить</button>
}
    
    
    
    
    
   

    
